<?php
class DashboardController extends AppController{
	var $name = "Dashboard";
	var $uses = array('User','Group','Post','Comment','Category','Comment', 'City');
	
	/** 
	 * Hien thi thong tin thong ke cho admin
	 *
	 * @Author:	Nguyen Xuan Thach
	 * @Date:	16/04/2011
	 * @Email: 	thachnuida@gmail.com
	 */
	function admin_index(){
		$this->layout = "admin";
		$users = $this->User->find('count');
		$groups = $this->Group->find('count');
		$posts = $this->Post->find('count');
		$comments = $this->Comment->find('count');
		$categories = $this->Category->find('count');
		$cities = $this->City->find('count');
		
		$last_comments = $this->Comment->find('all', 
			array(
				'limit' => 5,
				'order' => array('Comment.id DESC') 
			)
		);
		
		$this->set(compact('users','posts','comments','categories','groups','last_comments', 'cities'));
	}
}
?>